package com.ysd.service.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ysd.service.entity.Clock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * clock表 dao
 */
@Mapper
@Component
public interface ClockDao extends BaseMapper<Clock> {

    /**
     * 查询闹钟表里所有的city,包括对应的deviceId串
     * @return
     */
    @Select("SELECT city as city,GROUP_CONCAT(device_id) as deviceId FROM clock WHERE del_flag=0 AND city IS NOT NULL AND city <> '' GROUP BY city")
    List<Map<String, String>> queryCityDeviceIds();
}
